/**
 * @author 熊莎
 * @module 路由配置
 * @date   2020-5-22
 */

import React, { Suspense, lazy } from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';

class Router extends React.Component {
  render() {
    return (
      <BrowserRouter>
        <Suspense fallback={<div>Loading...</div>}>
          <Switch>
            <Route exact path="/" component={lazy(() => import('@src/pages/Home/index'))} />
            <Route exact path="/orderdetail/:phone" component={lazy(() => import('@src/pages/OrderDetail/index'))} />
            <Route exact path="/subscribe/:phone" component={lazy(() => import('@src/pages/Subscribe/index'))} />
            <Route exact path="/subscribetime/:type" component={lazy(() => import('@src/pages/SubscribeTime/index'))} />
            <Route exact path="/sub" component={lazy(() => import('@src/pages/OrderType/index'))} />
            <Route exact path="/login" component={lazy(() => import('@src/pages/Login/index'))} />
            <Route exact path="/yzm/:phone" component={lazy(() => import('@src/pages/Yzm/index'))} />
          </Switch>
        </Suspense>
      </BrowserRouter>
    );
  }
}

export default Router;
